import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';

export default async function a020(fd: IFeidaoAiBrowserComponent, args: { currentTarget: HTMLElement }) {
	// 筛选框 复选框
	const check_node = args.currentTarget as HTMLInputElement;
	const cid = check_node.dataset.feidaoId;		// 字段名
	const id = cid.replace('check_', '');
	const ckd_res = check_node.checked;

	// 输入框
	const input = fd.data.node.querySelector<HTMLInputElement>('[data-feidao-id=input_' + id + ']');
	if (input) {
		(ckd_res ? input.setAttribute("disabled", 'disabled') : input.removeAttribute("disabled"));
	}
	// 日期
	const begin_input = fd.data.node.querySelector('[data-feidao-id=begin_' + id + ']') as HTMLInputElement;
	if (begin_input) {
		(ckd_res ? begin_input.setAttribute("disabled", 'disabled') : begin_input.removeAttribute("disabled"));
	}
	const end_input = fd.data.node.querySelector('[data-feidao-id=end_' + id + ']') as HTMLInputElement;
	if (end_input) {
		(ckd_res ? end_input.setAttribute("disabled", 'disabled') : end_input.removeAttribute("disabled"));
	}
	// 数值
	const min_input = fd.data.node.querySelector('[data-feidao-id=min_' + id + ']') as HTMLInputElement;
	if (input) {
		(ckd_res ? min_input.setAttribute("disabled", 'disabled') : min_input.removeAttribute("disabled"));
	}
	const max_input = fd.data.node.querySelector('[data-feidao-id=max_' + id + ']') as HTMLInputElement;
	if (max_input) {
		(ckd_res ? max_input.setAttribute("disabled", 'disabled') : max_input.removeAttribute("disabled"));
	}
}
